#' 根据res创建补充表二（table_S2）
#'
#' @param res U5_mr分析出的res
#'
#' @return 补充表二
#' @export
#'
#' @examples
#'
#' \dontrun{
#'
#' table_S2<-U6_create_table_S1(res)
#'
#' }
#'
#'
#'
U6_create_table_S2<-function(res){
  require(dplyr)
  Table_S2 <- res %>% select(c("exposure", "outcome", "total_R2",
                               "mF", "IVW_Q_pval", "egger_intercept_pval", "power")) %>%
    rename(Heterogeneity = "IVW_Q_pval", Pleiotropy = "egger_intercept_pval",
           R2 = "total_R2", F = "mF", Exposure = "exposure",
           Outcome = "outcome", Power = "power") %>%
    rowwise() %>%
    mutate(across(where(is.numeric),tidy_num))  %>%
    mutate( R2 =  ifelse(is.na(R2), NA, sprintf("%.2f%%", as.numeric(R2) * 100)) )  %>%
    mutate( Power =  ifelse(is.na(Power), NA, sprintf("%.1f%%", as.numeric(Power) * 100)) )  %>%
    ungroup( )

  return(Table_S2)
}







